package com.xuchaotong.utils;

public class DemoCalc {
    public static void main(String[] args) {
        System.out.println(-1 & 15);
        System.out.println(0 & 15);
        System.out.println(1 & 15);
        System.out.println(2 & 15);
        System.out.println(3 & 15);
        System.out.println(16 & 15);
        System.out.println(17 & 15);


        System.out.println("----------------------------");

        System.out.println(Integer.toBinaryString(-2));
        System.out.println(Integer.toBinaryString(0));
        System.out.println(Integer.toBinaryString(1));
        System.out.println(Integer.toBinaryString(3));
        System.out.println(Integer.toBinaryString(7));
        System.out.println(Integer.toBinaryString(15));

        System.out.println("----------------------------");

        System.out.println(1 << 1);
        System.out.println(1 << 2);
        System.out.println(1 << 3);
        System.out.println(1 << 4);

        System.out.println("----------------------------");

        System.out.println(16 >> 1);
        System.out.println(16 >> 2);
        System.out.println(16 >> 3);
        System.out.println(16 >> 4);

        System.out.println("----------------------------");

        System.out.println(Math.pow(2,2));

        System.out.println("----------------------------");
        System.out.println(1 & 1);


    }
}
